#pragma once

#include <dshow.h>
#include <streams.h>
#pragma comment (lib,"Ole32.lib")
#pragma comment (lib,"Strmiids.lib")
class CRing :public CObject
{
public:
	 CRing(void);
public:
	 ~CRing(void);
public:
	//-------------------------------------------------------
	bool Create(HWND hNotifyWindow,CString sFile);
	void Delete();
	//-------------------------------------------------------
	//-------------------------------------------------------
	bool Run();
	bool Pause();	
	bool Stop();
	//-------------------------------------------------------
	IMediaEventEx * GetEventHandle(void);
	bool SetCurrentPosition(double inPosition);
	bool IsRunning();
private:
	//-------------------------------------------------------
	bool QueryInterfaces();
	bool RenderFile(CString sFile);
	bool SetNotifyWindow(HWND hwndNotify);

	//-------------------------------------------------------
	//-------------------------------------------------------

	bool IsPaused();
	bool IsStopped();
	//-------------------------------------------------------
private:
	//-------------------------------------------------------
	IMediaControl* m_pIMediaControl;
	IGraphBuilder* m_pIGraph;
	IMediaEventEx* m_pIEvent;
	IBasicAudio* m_pIBasicAudio;
	IMediaSeeking* m_pISeeking;
	//-------------------------------------------------------
public://
	void StartRing(int index);
	void RepeatRing();
	void StopRing();
};
